<!DOCTYPE html>

<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->

<!-- Head BEGIN -->
<head>
  <meta charset="utf-8">
  <title>二手手机收售管理系统</title>

  <meta content="width=device-width, initial-scale=1.0" name="viewport">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

  <meta content="Metronic Shop UI description" name="description">
  <meta content="Metronic Shop UI keywords" name="keywords">
  <meta content="keenthemes" name="author">

  <meta property="og:site_name" content="-CUSTOMER VALUE-">
  <meta property="og:title" content="-CUSTOMER VALUE-">
  <meta property="og:description" content="-CUSTOMER VALUE-">
  <meta property="og:type" content="website">
  <meta property="og:image" content="-CUSTOMER VALUE-"><!-- link to image for socio -->
  <meta property="og:url" content="-CUSTOMER VALUE-">

  <link rel="shortcut icon" href="favicon.ico">
    <link href="layui/css/layui.css" rel="stylesheet">

  <!-- Fonts START -->
  <!-- Fonts END -->

  <!-- Global styles START -->          
  <link href="assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet">
  <link href="assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <!-- Global styles END --> 
   
  <!-- Page level plugin styles START -->
  <link href="assets/plugins/fancybox/source/jquery.fancybox.css" rel="stylesheet">
  <link href="assets/plugins/owl.carousel/assets/owl.carousel.css" rel="stylesheet">
  <link href="assets/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css">
  <link href="assets/plugins/rateit/src/rateit.css" rel="stylesheet" type="text/css">
  <!-- Page level plugin styles END -->

  <!-- Theme styles START -->
  <link href="assets/pages/css/components.css" rel="stylesheet">
  <link href="assets/corporate/css/style.css" rel="stylesheet">
  <link href="assets/pages/css/style-shop.css" rel="stylesheet" type="text/css">
  <link href="assets/corporate/css/style-responsive.css" rel="stylesheet">
  <link href="assets/corporate/css/themes/red.css" rel="stylesheet" id="style-color">
  <link href="assets/corporate/css/custom.css" rel="stylesheet">
  <!-- Theme styles END -->
</head>
<!-- Head END -->

<!-- Body BEGIN -->
<body class="ecommerce">
    <!-- BEGIN STYLE CUSTOMIZER -->
    <div class="color-panel hidden-sm">
      <div class="color-mode-icons icon-color"></div>
      <div class="color-mode-icons icon-color-close"></div>
      <div class="color-mode">
        <p>THEME COLOR</p>
        <ul class="inline">
          <li class="color-red current color-default" data-style="red"></li>
          <li class="color-blue" data-style="blue"></li>
          <li class="color-green" data-style="green"></li>
          <li class="color-orange" data-style="orange"></li>
          <li class="color-gray" data-style="gray"></li>
          <li class="color-turquoise" data-style="turquoise"></li>
        </ul>
      </div>
    </div>
    <!-- END BEGIN STYLE CUSTOMIZER --> 

    <!-- BEGIN TOP BAR -->
    <div class="pre-header" id="loginiframe">
    </div>
    <!-- END TOP BAR -->

    <!-- BEGIN HEADER -->
    <div class="header">
        <div class="container" id="headeriframe">
            <!-- BEGIN CART -->
            <!--END CART -->
            <!-- BEGIN NAVIGATION -->
            <!-- END NAVIGATION -->
        </div>
    </div>
    <!-- Header END -->

    <div class="main">
      <div class="container" id="app">
        <!-- BEGIN SIDEBAR & CONTENT -->
        <div class="row margin-bottom-40">
          <!-- BEGIN CONTENT -->
          <div class="col-md-12 col-sm-12">
            <h1>商品回收</h1>
            <div class="goods-page" style="min-height: 500px;">
              <div class="goods-data clearfix">
                <div class="table-wrapper-responsive">
                    <button type="button" class="layui-btn" @click="recycleadd()">发布回收商品</button>
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th>图片</th>
                            <th>标题</th>
                            <th>预估价</th>
                            <th>描述</th>
                            <th>时间</th>
                            <th>备注</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="recycle in recyclelist">
                            <td style="text-align: center">
                                <img :src="['upload/'+recycle.filename]">
                            </td>
                            <td style="text-align: center">{{recycle.title}}</td>
                            <td style="text-align: center">
                                <template v-if="recycle.price>0">
                                    {{recycle.price}}
                                </template>
                                <template v-else>
                                    ???
                                </template>
                            </td>
                            <td style="text-align: center">{{recycle.content}}</td>
                            <td style="text-align: center">{{recycle.savetime}}</td>
                            <td style="text-align: center">
                                <template v-if="recycle.addr!=null && recycle.addr!=''">
                                    {{recycle.addr}}
                                </template>
                            </td>
                            <td style="text-align: center">{{recycle.status}}</td>
                            <td style="text-align: center">
                                <button  v-if="recycle.status=='已估价'" @click="updaterecyclestatus(recycle.id,'已同意')" type="button" class="layui-btn layui-btn-xs">同意</button>
                                <button  v-if="recycle.status=='已估价'" @click="updaterecyclestatus(recycle.id,'已拒绝')" type="button" class="layui-btn layui-btn-xs layui-btn-danger">拒绝</button>
                                <button  v-if="recycle.status=='待估价' || recycle.status=='已同意'  || recycle.status=='已拒绝'"  @click="del(recycle.id)" type="button" class="layui-btn layui-btn-xs layui-btn-danger">删除</button>
                            </td>
                        </tr>

                        <tr>
                            <td colspan="8"><div id="demo1" style="text-align:center"></div></td>
                        </tr>

                        </tbody>
                    </table>

                </div>

              </div>
            </div>
          </div>
          <!-- END CONTENT -->
        </div>
        <!-- END SIDEBAR & CONTENT -->

        <!-- BEGIN SIMILAR PRODUCTS -->

        <!-- END SIMILAR PRODUCTS -->
      </div>
    </div>

    <!-- BEGIN STEPS -->
    <!-- END STEPS -->

    <!-- BEGIN PRE-FOOTER -->
    <!-- END PRE-FOOTER -->

    <!-- BEGIN FOOTER -->
    <div class="footer" id="footiframe">
    </div>
    <!-- END FOOTER -->

    <!-- BEGIN fast view of a product -->

    <!-- END fast view of a product -->

    <!-- Load javascripts at bottom, this will reduce page load time -->
    <!-- BEGIN CORE PLUGINS (REQUIRED FOR ALL PAGES) -->
    <!--[if lt IE 9]>
    <script src="assets/plugins/respond.min.js"></script>  
    <![endif]-->  
    <script src="assets/plugins/jquery.min.js" type="text/javascript"></script>
    <script src="assets/plugins/jquery-migrate.min.js" type="text/javascript"></script>
    <script src="assets/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>      
    <script src="assets/corporate/scripts/back-to-top.js" type="text/javascript"></script>
    <script src="assets/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
    <!-- END CORE PLUGINS -->

    <!-- BEGIN PAGE LEVEL JAVASCRIPTS (REQUIRED ONLY FOR CURRENT PAGE) -->
    <script src="assets/plugins/fancybox/source/jquery.fancybox.pack.js" type="text/javascript"></script><!-- pop up -->
    <script src="assets/plugins/owl.carousel/owl.carousel.min.js" type="text/javascript"></script><!-- slider for products -->
    <script src='assets/plugins/zoom/jquery.zoom.min.js' type="text/javascript"></script><!-- product zoom -->
    <script src="assets/plugins/bootstrap-touchspin/bootstrap.touchspin.js" type="text/javascript"></script><!-- Quantity -->
    <script src="assets/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>
    <script src="assets/plugins/rateit/src/jquery.rateit.js" type="text/javascript"></script>

    <script src="assets/corporate/scripts/layout.js" type="text/javascript"></script>
    <!-- END PAGE LEVEL JAVASCRIPTS -->
</body>
<!-- END BODY -->
<script type="text/javascript" src="axios/vue.js"></script>
<script type="text/javascript" src="axios/axios.min.js"></script>
<script type="text/javascript" src="axios/qs.js"></script>
<script type="text/javascript" src="axios/getUrlParams.js"></script>
<script type="text/javascript" src="layer/layer.js"></script>
<script src="layui/layui.js" charset="utf-8"></script>
<script type="text/javascript">
</script>

<script type="text/javascript">
    var qs = Qs
    var vmm = new Vue({
        el: '#app',
        data: {
            recyclelist:[],
            pageSize:10,
        },
        mounted(){
            this.getrecyclelist()
        },
        methods: {
            updaterecyclestatus(id,status){
                axios.post('updaterecyclestatus',qs.stringify({
                    id:id,
                    status:status,
                })).then(response =>{
                    this.getrecyclelist()
                }).catch(error =>{
                    console.log(error)
                })
            },
            recycleadd(){
                var index = layer.open({
                    title:"发布商品回收",
                    type:2,
                    area:['600px','500px'],
                    maxmin:true,
                    content:"recycleadd.html"
                })
            },
            quxiao(id){
                axios.post('quxiao',qs.stringify({
                    id:id,
                })).then(response =>{
                    this.getrecyclelist()
                }).catch(error =>{
                    console.log(error)
                })
            },

            shouhuo(id){
                axios.post('shouhuo',qs.stringify({
                    id:id,
                })).then(response =>{
                    this.getrecyclelist()
                }).catch(error =>{
                    console.log(error)
                })
            },

            fukuan(id){
                var index = layer.open({
                    title:"订单付款",
                    type:2,
                    area:['500px','400px'],
                    maxmin:true,
                    content:"fukuan.html?id="+id
                })
            },

            getrecyclelist() {
                axios.post('recycleLb',qs.stringify({
                    key:this.key,
                    pageSize:this.pageSize,
                })).then(response =>{
                    layui.use(['laypage', 'layer'], function(){
                        var laypage = layui.laypage
                            ,layer = layui.layer;
                        //总页数大于页码总数
                        laypage.render({
                            elem: 'demo1'
                            ,limit:vmm.pageSize
                            ,count: response.data.list.length //数据总数
                            ,jump: function(obj,first){
                                vmm.current_page(obj.curr,vmm.pageSize)
                                console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                            }
                        });
                    });
                }).catch(error =>{
                    console.log(error)
                })
            },


            current_page(page,pageSize){
                axios.post('recycleLb',qs.stringify({
                    key:this.key,
                    pageNum:page,
                    pageSize:pageSize,
                })).then(response =>{
                    this.recyclelist = response.data.pageInfo.list
                }).catch(error =>{
                    console.log(error)
                })
            },

            del(id){
                axios.post('admin/recycleDel',qs.stringify({
                    id:id,
                })).then(response =>{
                    this.getrecyclelist()
                }).catch(error =>{
                    console.log(error)
                })
            },

        }
    });
</script>

<script type="text/javascript">
    window.onload=function(){
        $("#loginiframe").load("iframe/loginiframe.html")
        $("#headeriframe").load("iframe/headeriframe.html")
        $("#footiframe").load("iframe/footiframe.html")

    }
</script>
</html>